package com.dmwork.service.message.controller.front.me.feign;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dmwork.common.base.result.R;
import com.dmwork.common.base.util.JwtInfo;
import com.dmwork.common.base.util.JwtUtils;
import com.dmwork.service.message.entity.FeedFollowMessage;
import com.dmwork.service.message.service.FeedFollowMessageService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 用户动态推送表 前端控制器
 * </p>
 *
 * @author 李天
 * @since 2021-04-27
 */
@Slf4j
@RestController
@RequestMapping("/front/dm_work/message/feed_follow/me/feign")
public class FrontMeFeignFeedFollowMessageController {

    @Autowired
    private FeedFollowMessageService feedFollowMessageService;

    @GetMapping("get_unread_feed_id_list/{customerId}")
    public R getUnreadFeedIdList(@PathVariable("customerId") String customerId) {
        List<FeedFollowMessage> feedFollowMessageList = feedFollowMessageService.list(new QueryWrapper<FeedFollowMessage>().eq("follower_id", customerId).eq("read_status", 0));
        List<String> feedIdList=new ArrayList<>();
        for (FeedFollowMessage feedFollowMessage : feedFollowMessageList) {
            feedIdList.add(feedFollowMessage.getFeedId());
        }
        return R.ok().data("data", feedIdList);
    }

}

